﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace UIT.WPF
{
    public class Command : System.Windows.Input.ICommand
    {
        public Command(string commandName)
        {
            this.commandName = commandName;
        }
        public bool CanExecute(object parameter)
        {
            return NAcl.AclManager.IsAllowed("/Commands/" + commandName, "Execute");
        }

        public event EventHandler CanExecuteChanged;
        private string commandName;

        public void Execute(object parameter)
        {
            UIT.Context.Current.Application.CommandProcessor.ExecuteCommand(commandName, null, parameter);
        }
    }
}
